package net.towee.client.widgets.upload;


/**
 * Control file uploading progress
 * 
 * @author c58
 */
public interface UploadProgressHandler {
	/**
	 * This method invoked after onProgressUpdated with 100 percents parameter.
	 * 
	 * Response parameter is what server receive after uploading done. This
	 * method not invoked when server response an error.
	 * 
	 * @param response
	 */
	void onCompleteUploading(String response);
	
	/**
	 * Invoked when file added to uploading queue
	 * @param item
	 */
	void onUploadItemQueued();

	/**
	 * Invoked every time when progress of uploading updated
	 * 
	 * @param percents
	 * @param loadedBytes
	 * @param allBytes
	 */
	void onProgressUpdated(int percents, long loadedBytes, long allBytes);

	/**
	 * Invoked when server receive some error.
	 * 
	 * @param error
	 */
	void onErrorUploading(UploadError error);

	/**
	 * Invoked when uploading of give file canceled.
	 */
	void onCancelUploading();
	
	/**
	 * Invoked when data url of uploading image reed
	 * @param dataUrl
	 */
	void onDataURLReed(String dataUrl);

	/**
	 * Invoked when uploading started. Given boolean parameter
	 * is true when progress of uploading supported by browser.
	 * @param b
	 */
	void onUploadingStarted(boolean b);
}
